package com.zy.IntAddress;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/15 15:35
 **/
public class InteAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress address_1 = InetAddress.getByName("www.sunpinewater.tech");
        System.out.println( address_1);
//获取InetAddress 对象所含的域名
        System.out.println( address_1.getHostName());//获取InetAddress对象所含的IP地址
        System.out.println( address_1.getHostAddress());
        //获取本机的域名和IP地址。
        InetAddress address_2 = InetAddress.getLocalHost();
        System.out.println(address_2);
    }


}
